//
//  LXNavigationBar.m
//  SevenFM
//
//  Created by seven on 2018/3/29.
//  Copyright © 2018年 seven. All rights reserved.
//

#import "LXNavigationBar.h"

@implementation LXNavigationBar
/**
 *  设置全局的导航栏背景图片
 *
 *  @param globalImg 全局导航栏背景图片
 */
+(void)setGlobalBackGroundImage:(UIImage *)globalImg {
    UINavigationBar *navBar = [UINavigationBar appearanceWhenContainedIn:NSClassFromString(@"LXNavgationController"), nil];
    [navBar setBackgroundImage:globalImg forBarMetrics:UIBarMetricsDefault];
}
/**
 *  设置全局导航栏标题颜色
 *
 *  @param globalTextColor 全局导航栏标题颜色
 */
+(void)setGlobalTextColor:(UIColor *)globalTextColor andFontSize:(CGFloat)fontSize {
    if (globalTextColor == nil) {
        return;
    }
    if (fontSize < 6 || fontSize > 40) {
        fontSize = 16;
    }
    UINavigationBar *navBar = [UINavigationBar appearanceWhenContainedIn:NSClassFromString(@"LXNavgationController"), nil];
    NSDictionary *titleDict = @{
                                NSForegroundColorAttributeName: globalTextColor,
                                NSFontAttributeName: [UIFont systemFontOfSize:fontSize]
                                };
    [navBar setTitleTextAttributes:titleDict];
}
@end
